<template>
	<view>
		<view>
			<button @click="createGropu()">创建</button>
		</view>
		<view v-if="!groupList == []">
			<view v-for="(group,i) in groupList" :key="group.id">
				<uni-card @click="togroup(group.id)">
					<text>{{group.name}}</text>
					<rich-text >{{group.founder}}</rich-text>
				</uni-card>
			</view>
		</view>
	<view v-else>
		<text>????</text>
	</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				groupList: [
				],
				r: []
				
			}
		},
		onLoad() {
			this.getGroup()
		},
		onPullDownRefresh() {
			this.getGroup()
		},
		methods: {
			getGroup(){
				this.$http({
					url:"/bbservice/bbgroup/getGroupList",
					method:'GET',
					header: {
						"bbtoken": uni.getStorageSync("localtoken")
					}
				}).then(res =>{
					this.groupList = res.data.data.grouplist
				})
			},
			
			createGropu(){
				uni.navigateTo({
					url: "/pages/sub/group/createGroup/createGroup"
				})
			},
			togroup(id){
				uni.navigateTo({
					url: "/pages/sub/group/groupInfo/groupInfo?id="+id
				})
			}
			
		}
	}
</script>

<style>

</style>
